<?php 
      echo $this->Html->css("chosen");
      echo $this->Html->css("dataTables");
      echo $this->Html->css("validationEngine.jquery");
 ?>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/dataTables.min.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/customInput.jquery.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/chosen.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/zice.custom1.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/ColVis.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/accounting.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/layout_table.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/manager_wholesale.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/jquery.validationEngine.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/jquery.validationEngine-vi.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/jquery.autotab.js"></script>

<div class="titlePage">
<h1>Quản lý hóa đơn - Hóa đơn Bán sỉ</h1>
</div>

<div class="onecolumn">
	<div class="header">
	<span>
		<span class="ico gray window"></span>
		Tìm kiếm hóa đơn
	</span>
	</div>
	<div class="clear"></div>
	<div class="content" style="display: inline-block; width: 95%;">
		<form id="formSearch" method="post" action="">
			<div class="section">
				<label> Mã HĐ :</label>   
                <input type="text" name="idInvoice" class='validate[custom[number]]' />
            </div>
			<div class="section" style="float:left; width: 40%; border-bottom: none;">
				<label>
				Khách hàng:
				
				</label>
				<div id='search_cus'>
					<select data-placeholder="Chọn khách hàng..." class="chzn-select choose_cus" tabindex="2" name="choose_cus">
                          <option value=""></option> 
                          <?php foreach ($customers as $item) {?>
							<option value="<?php echo $item['c']['id']; ?>"><?php echo $item['c']['name'];}?></option>
                     </select>
					
				</div>
			</div>
			<div class="section" style="float:left; width: 30%; border-bottom: none;">
				<label> Tổng tiền </label>   
                <div>Từ <input type="text" name="totalStart"/></div>
                <div>đến <input type="text" name="totalEnd"/></div>
            </div>
            <div class="section" style="float:left; width: 30%;border-bottom: none;">
                <label>Ngày mua: </label>   
                <div>Từ <input type="text"  id="dateStart" class="dateStart" name="dateStart"  /></div>
                <div>đến <input type="text"  id="dateEnd" class="dateEnd" name="dateEnd"  /></div>
            </div> 
            <input type="hidden"  id="isSearch" class="isSearch" name="isSearch" value="1"/> 
            <div class="buttonSearchInvoice" style="text-align: center;">
				<a class="uibutton" id='search_invoice'><span class="ico gray checkmark2"></span>Tìm kiếm</a>
				<div id='alert_mes'></div>
			</div>
		</form>
	</div>
</div>
<?php if($isSearch){?>
<div class="onecolumn invoice">
	<div class="header">
	<span>
		<span class="ico gray spreadsheet"></span>
		DANH SÁCH HÓA ĐƠN
	</span>
	</div>
	<div class="clear"></div>
	<div class="content">
		<form>
			<div class="tableName">
				<table class="display data_table2 listWsInvoice" >
					<thead>
						<tr>
							<th><div class="th_wrapp">Khách hàng</div></th>
							<th><div class="th_wrapp">Tổng tiền</div></th>
							<th><div class="th_wrapp">Nợ</div></th>
							<th><div class="th_wrapp">Ngày mua</div></th>
							<th><div class="th_wrapp"></div></th>
						</tr>
					</thead>
					<tbody>
					<?php 
						foreach ($list_invoice as $item) {
					?>
							<tr class="odd gradeX " id="<?php  echo $item['wh']['id']; ?>">
		      					<td class='WsInvoice'><?php  echo $item['c']['name'];?></td>
		      					<td class='formatMoney WsInvoice'><?php  echo $item['wh']['total']; ?></td>
		      					<td class='formatMoney WsInvoice'><?php  echo $item['wh']['own']; ?></td>
		      					<td class='WsInvoice WsInvoice'><?php  echo date('d/m/Y H:i',strtotime($item['wh']['date']));?></td>
		      					<td > 
		      					<?php if ($item['wh']['status']== 1){?>
		      						<span class="tip" >
	                                       <a title="Chưa giao"  >
	                                           <img src="<?php echo $this->webroot; ?>img/icon/checkmark3.png" >
	                                       </a>
	                                </span>            
                                <?php } if ($item['wh']['status']== 2){?>
		      						<span class="tip" >
	                                       <a title="Đang giao"  >
	                                           <img src="<?php echo $this->webroot; ?>img/icon/checkmark4.png" >
	                                       </a>
	                                </span>
	                                
                                <?php } if ($item['wh']['status']== 3){?>
		      						<span class="tip" >
	                                       <a title="Đã giao"  >
	                                           <img src="<?php echo $this->webroot; ?>img/icon/checkmark2.png" >
	                                       </a>
	                                </span>
	                            <?php }?>
	                                  
	                            </td>
		      					</tr><?php }?>
					</tbody>
				</table>
	            </div>
		</form>
	</div>
</div>
<div class="onecolumn listInvoiceProduct">
<div class="header">
	<span>
		<span class="ico gray paragraph_justify"></span>
		CHI TIẾT HÓA ĐƠN
	</span>
	</div>
	<div class="clear"></div>
	<div class="content">
		<div class="toolbar1"></div>
		<div id="uploadTab">
            <ul class="tabs" >
                   <li ><a href="#tab1"   >   Hàng hóa mua  </a></li>  
                   <li ><a href="#tab2"   >   Hàng khuyến mãi  </a></li>            
            </ul>
	        <div class="tab_container" >
				<div id="result_choose_ws_invoice">
				
				</div>
			</div>
		</div>
	</div>
</div>
<?php }?>